﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using WBasicClassLib.Helper;

namespace FileHelper_Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("正在创建和向Test.txt输入内容...");
            FileHelper.WriteStringToFile("Test.txt", "This is WBasicClassLib!!!\nThanks 4 using!!!", Encoding.UTF8);
            Console.WriteLine("创建和初始化完毕！！！");
            Console.WriteLine("现在从Test.txt读出之前写入的内容并显示：");
            Console.WriteLine(FileHelper.ReadStringFromFile("Test.txt", Encoding.UTF8));
            Console.WriteLine("例程完毕！");
            Console.WriteLine("在当前目录下创建一个新的空文件Empty.txt...");
            FileHelper.CreateFile("Empty.txt");
            Console.WriteLine("创建完毕，现在进行验证：");
            Console.WriteLine("Empty.txt是否存在？{0}", File.Exists("Empty.txt"));
            Console.WriteLine("删除Empty.txt...");
            FileHelper.DeleteFile("Empty.txt");
            Console.WriteLine("删除完毕，现在进行验证：");
            Console.WriteLine("Empty.txt是否存在？{0}", File.Exists("Empty.txt"));
            Console.ReadLine();
        }
    }
}
